<?php

include '../../db.php';
$connect = pg_connect($connectionString);
if (!$connect) {
    echo "connect : A connection to the server could not be established!";
    return false;
}

$params = array();
array_push($params, pg_escape_string(strtoupper($_POST["name"])));
array_push($params, pg_escape_string($_POST["password"]));
array_push($params, pg_escape_string($_POST["type_id"]));

$stmt = pg_prepare($connect, "create_config_user", "INSERT INTO config_user(name,password,type_id) VALUES ($1,$2,$3);");
$result = pg_execute($connect, "create_config_user", $params);

if (!$result) {
    die("Error in SQL query: " . pg_last_error());
}
pg_free_result($result);
pg_close($connect);